package cc.rengu.redp.job.domain;


import cc.rengu.redp.common.converter.CustomConverter;
import cc.rengu.redp.common.converter.ExcelCustomConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@ExcelIgnoreUnannotated
@TableName("t_job_log")
public class JobLog implements Serializable {

    private static final long serialVersionUID = -7114915445674333148L;

    // 任务执行中
    public static final String JOB_IN_RUNNING = "2";
    // 任务执行成功
    public static final String JOB_SUCCESS = "0";
    // 任务执行失败
    public static final String JOB_FAIL = "1";

    @TableId(value = "LOG_ID")
    private Long logId;

    private Long jobId;

    @ExcelProperty(value = "Bean名称")
    private String beanName;

    @ExcelProperty(value = "方法名称")
    private String methodName;

    @ExcelProperty(value = "方法参数")
    private String params;

    @ExcelProperty(value = "状态", converter = CustomConverter.class)
    @ExcelCustomConvert(value = {"0", "1"}, label = {"正常", "失败"})
    private String status;

    @ExcelProperty(value = "异常信息")
    private String error;

    @ExcelProperty(value = "耗时（毫秒）")
    private Long times;

    @ExcelProperty(value = "执行时间")
    private Date createTime;

    @TableField(exist = false)
    private String createTimeFrom;

    @TableField(exist = false)
    private String createTimeTo;

}
